import http from "@/utils/http.js";

/**
 * @description: 获取最新的购物车列表
 * @param {*}
 * @return {*}
 */
export function findNewCartListAPI(){
    return http.get('/shoppingCart/get');
}


/**
 * @description: 根据sku对象进行新增购物车
 * @param {sku} 用户对象
 * @return {*}
 */
export function insertCartAPI(sku){
    return http.post('/shoppingCart/add',sku);
}

/**
 * @description: 根据ids删除购物车
 * @param {*}
 * @return {*}
 */
export const delCartAPI = (ids) => {
    return http.delete('/shoppingCart/delete',{data:{ids}})
}

//合并购物车
export function mergeCartAPI(data){
    return http.post('/shoppingCart/addList',data);
}

/**
 * updateCartGoods
 * @param {object} params ShoppingCartUpdateRequest
 * @param {number} params.skuId
 * @param {number} params.quantity
 * @returns
 */
export function updateCartGoods(params) {
    return http.put(`/shoppingCart/update`, params);
}